class Printer:
    sum1 = 0

    def __init__(self, sum1):
        self.sum1 = sum1
        print(self.__class__.sum1)

    # 装饰器，变成类方法
    @classmethod
    def plus_sum(cls):
        cls.sum1 += 1
        print(cls.sum1)

    @staticmethod
    def add(x, y):
        print('this is a static method')
        print(Printer.sum1)


p1 = Printer
p1.add(1, 2)
Printer.add(2, 3)

# Printer.plus_sum()

# 不推荐使用对象访问类方法
# p1.plus_sum()
# p1.plus_sum()
